<template>
<div>
<Modal v-model="modalEdit" fullscreen @on-cancel="handleModalEditCancel">
	<template #header>
		<Icon custom="iconfont icon-Word"/>&nbsp;责令改正违法行为通知书&nbsp;
		{{baseform.party_name}}&nbsp;涉嫌&nbsp;{{baseform.cause_name}}
	</template>
	<template #footer><Space>
		<Button shape="circle" @click="handleModalEditCancel">取消</Button>
		<Button type="primary" shape="circle" @click="handleModalEditOK">提交</Button>
	</Space></template>
	<div><Row justify="center"><Col span="16"><Form ref="baseform" :model="baseform" :rules="ruleValidate" :label-width="10">
		<Card title="责令改正" icon="ios-bookmark">
			<template #extra>
				提交日期：<DatePicker v-model="baseform.date1" type="date" placeholder="选择日期" style="width: 200px"></DatePicker>
			</template>
			<FormItem label="" prop="checkn" required>
				<RadioGroup v-model="baseform.checkn">
					<Radio label="立即停止违法行为" border></Radio><br><br>
					<Radio label="立即改正违法行为" border></Radio><br><br>
					<Radio label="限期改正违法行为" border></Radio><br><br>
					<div v-if="baseform.checkn==='限期改正违法行为'">
						改正截至日期： <DatePicker v-model="baseform.date2" type="date" placeholder="输入日期" style="width: 200px"/><br><br>
					</div>
					<Radio label="具体改正内容及要求如下" border></Radio><br><br>
				</RadioGroup>
				<div v-if="baseform.checkn==='具体改正内容及要求如下'">
					<Input v-model="baseform.content" maxlength="100" show-word-limit :rows="5"
					type="textarea" placeholder="改正内容及要求" style="width: 100%" />
				</div>
			</FormItem>
			
		</Card>
	</Form></Col></Row></div>
</Modal>
</div>
</template>

<script>
import {dateUtils,appendDoc} from '@/libs/tools.js'
import config from '@/config'
export default{
	data(){
		return {
			modalEdit:true,
			baseform:{},
			ruleValidate:{
				checkn: [{ required: true, message: '请输入改正类型'}],
			}
		}
	},
	methods:{
		handleModalEditCancel(){
			this.$router.go(-1)
		},
		handleModalEditOK(){
			let data={...this.baseform}
			data.undertaker_name=this.$store.state.user.userInfo.uname
			dateUtils.formatDates(data,"date1","date2")
			data.docs=appendDoc(data.docs,"doc001")
			this.$refs.baseform.validate((valid) => {if (valid) {
				this.$axios.post('mainCase1CreateDoc001.action',data).then(res=>{
					window.open(config.baseUrl+res.data,'_blank')
				})
				this.$router.go(-1)
			}})	
		}
	},
	mounted(){
		this.$axios.post('mainCase1GetDoc001.action',{
			case_no:this.$route.query.case_no,
			party_type:this.$route.query.party_type
		}).then(res=>{
			this.baseform={...this.baseform,...res.data}
			dateUtils.dateNotNull(this.baseform,"date1")
		})
	}
}
</script>

<style>
</style>